from api_post_class import *
from config import *
def CreateAgent():
    authType = 1
    operation = "CallCenter"
    function = "createAgent"
    params = {
        "workNumber": "zhangmentest",
    }
    f = ApiPost(auth_info, domain, version, "json")

    f.set_func_mode(operation, function, authType)
    rsp = f.post_info_to_api(params)
    print(rsp)
    try:
        if rsp['resp']['respCode'] != 0:
            print("Error, please check and retry")
    except Exception as e:
        print(e)

def DropAgent():
    authType = 1
    operation = "CallCenter"
    function = "dropAgent"
    params = {
        "workNumber": "zhangmentest",
    }
    f = ApiPost(auth_info, domain, version, "json")

    f.set_func_mode(operation, function, authType)
    rsp = f.post_info_to_api(params)
    print(rsp)
    try:
        if rsp['resp']['respCode'] != 0:
            print("Error, please check and retry")
    except Exception as e:
        print(e)

def BindDevice():
    authType = 1
    operation = "CallCenter"
    function = "bindDevice"
    params = {
        "workNumber": "hhhlll2",
        "deviceNumber":"66600001",
        "type": 1,
    }
    f = ApiPost(auth_info, domain, version, "json")

    f.set_func_mode(operation, function, authType)
    rsp = f.post_info_to_api(params)
    print(rsp)
    try:
        if rsp['resp']['respCode'] != 0:
            print("Error, please check and retry")
    except Exception as e:
        print(e)

def UnbindDevice():
    authType = 1
    operation = "CallCenter"
    function = "unbindDevice"
    params = {
        "workNumber": "hhhlll2",
    }
    f = ApiPost(auth_info, domain, version, "json")

    f.set_func_mode(operation, function, authType)
    rsp = f.post_info_to_api(params)
    print(rsp)
    try:
        if rsp['resp']['respCode'] != 0:
            print("Error, please check and retry")
    except Exception as e:
        print(e)

def ChangeDevMode():
    authType = 1
    operation = "CallCenter"
    function = "changeDevMode"
    params = {
        "workNumber": "hhhlll2",
        "deviceNumber":"15861800293",
        "type": 0,
    }
    f = ApiPost(auth_info, domain, version, "json")

    f.set_func_mode(operation, function, authType)
    rsp = f.post_info_to_api(params)
    print(rsp)
    try:
        if rsp['resp']['respCode'] != 0:
            print("Error, please check and retry")
    except Exception as e:
        print(e)

def GetBindDevice():
    authType = 1
    operation = "CallCenter"
    function = "getBindDevice"
    params = {
        "workNumber": "hhhlll2",
    }
    f = ApiPost(auth_info, domain, version, "json")

    f.set_func_mode(operation, function, authType)
    rsp = f.post_info_to_api(params)
    print(rsp)
    try:
        if rsp['resp']['respCode'] != 0:
            print("Error, please check and retry")
    except Exception as e:
        print(e)

if __name__ == "__main__":
    #CreateAgent()
    #DropAgent()
    #BindDevice()
    #GetBindDevice()
    #ChangeDevMode()
    #GetBindDevice()
    UnbindDevice()
    #GetBindDevice()